﻿@using Gfw.Infrastructure.Stock.Enums
@model IEnumerable<Gfw.Web.Models.Stock.AgencyModel>
@{
    ViewBag.Title = "撤单";
    Layout = "~/Views/Shared/_LayoutContent.cshtml"; 
}

@if (ViewBag.CanCancel)
{
<table id="mytable">
    <tr>
        <th>
            操作
        </th>
        <th>
            @Html.DisplayNameFor(model => model.TradeType)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.AgencePrice)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.AgenceCount)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.AgenceDate)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.TradeCount)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.TradeStatus)
        </th>
    </tr>
    @foreach (var item in Model)
    {
        <tr>
            <td>
                @if (item.ForceType == (int)ForceTradeTypeEnum.ForceSell)
                {
                    <text>强制性交易</text>
                }
                else
                {
                @Html.ActionLink("撤单", "CancelTrade", new { id = item.AgencyId })
                }
            </td>
            <td>
                @{
        if (item.TradeType == (int)TradeTypeEnum.Buy)
        {
                    <span>买入</span>
        }
        else
        {
                    <span>卖出</span>
        }
                }
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.AgencePrice)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.AgenceCount)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.AgenceDate)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.TradeCount)
            </td>
            <td>
                @{
        if (item.TradeStatus == (int)TradeStatusEnum.WaitTrade)
        {
                    <span style="color: Green">已提交</span>
        }
        else
        {
                    <span style="color: Red">已成交</span>
        }
                }
            </td>
        </tr>
    }
</table>
}
else
{
     <h5>
        当前时间不能进行撤单操作。</h5>
    <div class="button">
        @Html.ActionLink("返回", "Index")
    </div>
}
